﻿var html = ""; //添加元素的html代码
//var center; //小区中心点
//var center = { x: 116.47466421824433, y: 39.90788091996372 };
//var ssqy; //小区所属的区块
var scene; //场景
var url = document.URL; //页面导航栏地址
//var commname;
//var arrayid; //显示楼的smid
var layerdom; //dom图层
var room; //记录房号
var imageryLayers; //影像图层
var Range = 350; //
var Value = 202; //确定滑块位置
var promisemodel; //模型层
var promisemodel12;
var promisehouse = ""; //户层
var array = [];
var arraysx = []; //符合筛选条件的数组
var viewer;
var array1; //显示户的id
var pagesize = 7; //页面初始化时候显示的记录数（0-7）最多8条
var pageno; //每页显示的记录数
var htmlUrl = document.location.host;
var port = document.location.port;
//var cont = 1; //用来标记初始化是否显示房源
var btncount = 1; //全局变量用来记录是全景周边还是3d楼盘
var url = document.URL;
var para = "";
var resu1, resu2; //查询出来的记录数结果

var roomNo = []; //房间id集合
var arrayfh, arrayfh1;
var longitude, latitude;
var promisemodellczx;//乐成中心增加的一个楼图层
if (htmlUrl == "") {
  htmlUrl = "http://localhost:" + port;
} else {
  htmlUrl = "http://" + htmlUrl;
}

var buildingName = "";
//楼盘信息
// setTimeout(function(){
ajax(
  "/api/v1/building/getBuildingInfo",
  "post",
  { buildingId: buildid },
  function(result) {
    if (result.code == 200) {
      longitude = result.data.longitude;
      latitude = result.data.latitude;
      addConsulting(result.data.companyId)
      point1 = new BMap.Point(parseFloat(longitude), parseFloat(latitude));
      var myIcon = new BMap.Icon(
        "http://api.map.baidu.com/img/markers.png",
        new BMap.Size(23, 25),
        {
          offset: new BMap.Size(10, 25), // 指定定位位置
          imageOffset: new BMap.Size(0, 0 - 10 * 25) // 设置图片偏移
        }
      );
      var marker = new BMap.Marker(point1, { icon: myIcon });
      // marker.setLabel(new BMap.Label(commname));
      map.addOverlay(marker);
      var circle = new BMap.Circle(point1, 1000, {
        fillColor: "#ccc",
        strokeWeight: 1,
        fillOpacity: 0.2,
        strokeOpacity: 0.2
      });
      btn("jt", "地铁");
      buildingName = result.data.buildingName;
      $("#title1").html(result.data.buildingName);
      $("#phone").attr(
        "data-original-title",
        result.data.tel1 + "   " + result.data.tel2
      );
      $("#phone").on('click',function(){
        if(result.data.companyType){
          
        }
      })
      $("#forTime").html(forDate(result.data.updateTime));
      $("#address").html(result.data.address);
      $("#jcnd").html(result.data.buildingYear + "年");
      $("#jzmj").html(result.data.totalArea + "m²");
      $("#sssq").html(result.data.tradingArea);
      $("#ldsl").html(result.data.totalNum);
      $("#szhx").html(result.data.loopName);
      $("#zglc").html(result.data.totalFloors);
      $("#kfs").html(result.data.developer);
      $("#lpdz").html(result.data.address);
      $("#ktsl").html(result.data.elevatorNum);
      $("#tcss").html(
        "地下停车位 :" +
          result.data.underParking +
          "、地上停车位:" +
          result.data.overParking
      ); //停车设施
      $("#kt").html(result.data.airConditioning);
      $("#rzqy").html(result.data.inCompanys);
      $("#wygs").html(result.data.managementCompany);
      $("#wyf").html(result.data.managementFee + "元/m² · 月");
      $("#tsfw").html(result.data.featureService);
      $("#lpjs").html(result.data.buildingIntroduce);
      document.getElementById("wygs").title = result.data.managementCompany;
      document.getElementById("wyf").title =
        result.data.managementFee + "元/m² · 天";
      document.getElementById("tsfw").title = result.data.featureService;
      if (result.data.buildingFlag == 1) {
        $("#three-click").show();
        // var str =
        //   '<a style="margin-left:5px;" href="javascript:;" data-type="three-d">3D</a>';
        // $("#img-3D-tab").append(str);
      } else {
        $("#three-click").hide();
      }
    }
  }
  
);
function goSearchB(type) {
  if (type == 0) {
    window.open("/item/views/search/searchBuildingHouse.html?keyword=" + buildingName);
  } else {
    var buildingId = getParams("buildid");
    window.open(
      "/item/views/search/searchUnitedCommunity.html?buildingId=" + buildingId
    );
  }
}
//添加咨询次数
function addConsulting(id) {
	ajax("/api/v1/consult/append", "post", { type: '3', resourceId: id }, function(
	  data
	) {
	  console.log()
	});
}

//楼盘周边推荐
ajax(
  "/api/v1/building/recommendedBuildingNearby",
  "post",
  { buildingId: buildid },
  function(result) {
    if (result.code == 200 && result.data != null) {
      for (var i = 0; i < result.data.length; i++) {
        var image = "static/ffyxq/images/noupload.png",
          directFlag = "",
          buildingFlag = "";
        if (result.data[i].imgUrl) {
          image = getImgUrl() + result.data[i].imgUrl;
        } else {
          image = "static/ffyxq/images/noupload.png";
        }
        if (result.data[i].directFlag == 1) {
          directFlag = "直租计划";
        } else {
          directFlag = "";
        }
        if (result.data[i].buildingFlag == 1) {
          buildingFlag = '<img src="static/ffyxq/images/3D.svg"></a>';
        } else {
          buildingFlag = "";
        }

        $("#zbtj").append(
          "<li onclick='goToBuildingDetails( \"" +
            result.data[i].buildingName +
            '","' +
            result.data[i].buildingId +
            "\" )'>" +
            '<div class="small-pro-list-info">' +
            '<div class="pic">' +
            '<img src="' +
            image +
            '">' +
            '<a href="javascript:;" class="threeD">' +
            buildingFlag +
            "" +
            "</div>" +
            '<div class="remark">' +
            '<div class="clearfix">' +
            '<a href="javascript:;" class="ellipsis-1 pull-left" style="width:150px;">' +
            result.data[i].buildingName +
            "</a>" +
            '<span class="zhizu-plan pull-right">' +
            directFlag +
            "</span>" +
            "</div>" +
            '<div class="detail-info clearfix">' +
            '<div class="pull-left">' +
            result.data[i].minArea +
            "m²-" +
            result.data[i].maxArea +
            "m²在租</div>" +
            '<div class="pull-right" style="line-height:17px;">' +
            '<span class="blue" style="font-size:16px;">' +
            result.data[i].price +
            "</span>" +
            "<small> 元/m²·天</small>" +
            "</div>" +
            "</div>" +
            "</div>" +
            "</div>" +
            "</li>"
        );
      }
    }
  }
);
function onload(Cesium) {
  if (dzc_service != undefined) {
    viewer = new Cesium.Viewer("scenediv", {
      terrainProvider: new Cesium.CesiumTerrainProvider({
        url: dzc_service.serverurllayers.terrain,
        requestWaterMask: true, //是否请求水面标志位（用于水面特效），默认不请求
        requestVertexNormals: true, //是否请求法线（用于光照效果），默认不请求
        isSct: true //是否为iServer发布的TIN地形服务
      })
    });

	 var sql="LPBH ='"+commname+"'";
		var queryconfig={
		        url:dataurl,
		        sql:sql,
		        layerName:dzc_service.layers.layerhousehold,
		        datalayerName:dzc_service.datalayers.layerhousehold,
		        callback:processCompletedcxlp
		    };
		_queryBySql(queryconfig);
    //初始化户集合
    array1 = [];
    scene = viewer.scene;
    imageryLayers = viewer.imageryLayers;
    //添加影像
    var imageryProvider1 = new Cesium.SuperMapImageryProvider({
      url: dzc_service.serverurllayers.imageWhiteBase
    });
    //全球影像地图服务(经纬度)
    /*var labelImagery = new Cesium.TiandituImageryProvider({
	     mapStyle : Cesium.TiandituMapsStyle.IMG_C
		});*/
    var widget = viewer.cesiumWidget;
    //添加影像
    //var tdtlayer = imageryLayers.addImageryProvider(labelImagery);
    var layer1 = imageryLayers.addImageryProvider(imageryProvider1);
    var imageryProviderdom = new Cesium.SuperMapImageryProvider({
      url: dzc_service.serverurllayers.Dom["HM"]
    });
    layerdom = imageryLayers.addImageryProvider(imageryProviderdom);
    layerdom.show = false;
    scene.screenSpaceCameraController.enableZoom = false;
    scene.sun.show = false;
    //添加鼠标移动事件，功能实现指北针方位和场景方位一致
    var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
    handler.setInputAction(function(movement) {
      var heading = scene.camera.heading;
      var ss = (heading * 180) / 3.14;
      document.getElementById("img1").style.transform =
        "rotate(" + -ss + "deg)";
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
    viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
      Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
    );
    $("#qjzbbtn").click(function() {
      if ($(this)[0].innerHTML == "全景周边") {
        btncount = 0;
        viewer.entities.removeAll();
        viewer.entities._show = true;
        $("#qjzbbtn").html("3D楼盘");
        if (cnt == 0) {
          promisemodel.then(function(layer) {
            layer.visible = true;
          });
          promisemodel12.then(function(layer) {
            layer.selectEnabled = false;
            layer.visible = true;
          });
 if(commname == "BJCY010" || commname == "乐成中心"){
					 promisemodellczx.then(function(layer){
						 layer.selectEnabled = false;
					     layer.visible = true;
					 });
				 }
          layerdom.show = true;
          reset();
          mark(); //全景周边中楼标注
        }
      } else {
        btncount = 1;
        viewer.entities.removeAll();
        $("#qjzbbtn").html("全景周边");
        viewer.entities._show = true;
        louhao();
        if (cnt == 0) {
          promisemodel.then(function(layer) {
            $("#ditu").css({ display: "none" });
            $("#gif").css({ display: "none" });
            layer.selectEnabled = false;
            layer.visible = true;
          });
          promisemodel12.then(function(layer) {
            layer.selectEnabled = false;
            layer.visible = false;
          });
if(commname == "BJCY010" || commname == "乐成中心"){
					 promisemodellczx.then(function(layer){
						 layer.selectEnabled = false;
					     layer.visible = false;
					 });
				 }
        }
        layerdom.show = false;
        reset();
        var arr = viewer.entities.values;
      }
    });
    if (cnt == 0) {
      promisemodel = scene.addS3MTilesLayerByScp(
        dzc_service.serverurllayers.Model["HM"],
        {
          name: "model"
        }
      );
      promisemodel12 = scene.addS3MTilesLayerByScp(
        dzc_service.serverurllayers.Model["HM12"],
        {
          name: "model12"
        }
      );
if(commname == "BJCY010" || commname == "乐成中心"){
				promisemodellczx = scene.addS3MTilesLayerByScp(dzc_service.serverurllayers.Model['LCZX'],{
					 name : "modellczx"
				 });
				promisemodellczx.then(function(layer){
					 layer.selectEnabled = false;
				     layer.visible = false;
				 });
			}
      promisemodel12.then(function(layer) {
        layer.selectEnabled = false;
        layer.visible = false;
        layer.lodRangeScale = 0.2;
      });
      promisemodel.then(function(layer) {
        layer.selectEnabled = false;
        layer.visible = true;
        layer.lodRangeScale = 0.2;
      });
      promisehouse = scene.addS3MTilesLayerByScp(
        dzc_service.serverurllayers.Household,
        {
          name: "household"
        }
      );
      promisehouse.then(function(layer) {
        layer.setQueryParameter({
          //设置查询参数
          url: dataurl,
          dataSourceName: "AttachData", //数据源
          dataSetName: "Household" //数据集
        });
        layer._selectColorType = 1;
        layer.selectEnabled = true;
        layer.visible = false;
        //layer.setObjsVisible([9098,9114],true);
        //layer.setObjsColor([9098,9114],new Cesium.Color(0,139/255,210/255,1));
      });
      if (btncount == 0) {
        Range = 474;
        var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
          Cesium.Cartesian3.fromDegrees(
            center.x - 0.00000000045916,
            center.y,
            tranheight
          )
        );
        var heading = Cesium.Math.toRadians(parseInt(lpheading));
        var pitch = Cesium.Math.toRadians(-35.0);
        var range = 474.0;
        scene.camera.lookAtTransform(
          transform,
          new Cesium.HeadingPitchRange(heading, pitch, range)
        );
      } else {
        Range = range1;
        var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
          Cesium.Cartesian3.fromDegrees(
            center.x - 0.00000000045916,
            center.y,
            tranheight
          )
        );
        var heading = Cesium.Math.toRadians(Number(lpheading));
        var pitch = Cesium.Math.toRadians(pitchcsh);
        var range = range1;
        scene.camera.lookAtTransform(
          transform,
          new Cesium.HeadingPitchRange(heading, pitch, range)
        );
      }
    }
   // yzfh(commname); //显示出户
    louhao(); //显示出楼号
    fy(); //分页分页
gethousehold();//显示出户
    // if(promisehouse != ""){
    // 	promisehouse.then(function(layer){
    // 		layer._selectColorType = 1;
    //     	layer.visible = true;
    //     	layer.setObjsVisible(array,true);
    // 	    layer.setObjsColor(array,new Cesium.Color(0,139/255,210/255,1));
    //     });
    // 	}
    if (promisehouse != "") {
      if (array.length > 0) {
        promisehouse.then(function(layer) {
          layer._selectColorType = 1;
          layer.visible = true;
          layer.setObjsVisible(array, true);
          layer.setObjsColor(
            array,
            new Cesium.Color(0, 139 / 255, 210 / 255, 1)
          );
        });
      } else {
        promisehouse.then(function(layer) {
          layer._selectColorType = 1;
          layer.visible = false;
        });
      }
    }
//点击三维场景中的户，联动数据列表
    viewer.pickEvent.addEventListener(function(feature){
	    	promisehouse.then(function(layer){
	    		/*room = feature.ROOMNO;
	    		smid1 = feature.SMID;*/
	    		layer._selectColorType = 1;
	    		$("#listfjh div").css({'background-color':''});
	    		//layer.setObjsColor([feature.SMID],new Cesium.Color(0,139/255,210/255,1));
	    		if(room){
	    			
	    			$("#"+feature.ROOMNO).css({'background-color':'#EEEEEE'});
	    			layer.setObjsColor([smid1],new Cesium.Color(0,139/255,210/255,1));
	    			layer.setObjsColor([feature.SMID],Cesium.Color.YELLOW);
	    			
	    		}else{
	    			layer.setObjsColor([feature.SMID],Cesium.Color.YELLOW);
	    			$("#"+feature.ROOMNO).css({'background-color':'#EEEEEE'});
	    			
	    		}
	    		room = feature.ROOMNO;
	    		smid1 = feature.SMID;
	    		
	    	});
	    	 //var ids = [];
	    
	    });
  } else {
    fy();
  }
}
function searchmc() {
  //楼盘搜索
  ajax(
    "/api/v1/building/searchBuildingPage",
    "post",
    { placeType: "1", gardenType: "1", page: "1", size: "8" },
    function(result) {
      console.log(result);
    }
  );
}
//点击面积、楼层、查询结果
function cxjg(arraydi) {
  var arraydi1 = unique(arraydi);
  $("#listfjh").empty();
  roomNo = [];
  for (var i = 0; i < pagesize + 1; i++) {
    for (var j = 0; j < arraydi1.length; j++) {
      if (resu1.data.list[i] != undefined) {
        if (resu1.data.list[i].roomNo == arraydi1[j]) {
          var temp = resu1.data.list[i].releaseTime;
          if (temp != null) {
            var time = temp.substring(0, temp.length - 9);
          } else {
            var time = "";
          }
          var image = "static/ffyxq/images/noupload.png";
          if (resu1.data.list[i].imgUrl) {
            image = getImgUrl() + resu1.data.list[i].imgUrl;
          } else {
            image = "static/ffyxq/images/noupload.png";
          }
          var area = resu1.data.list[i].area;
          $("#listfjh").append(
            '<div id="' +
              resu1.data.list[i].roomNo +
              '" onmouseover="movein(this)" onclick="fyxq(' +
              resu1.data.list[i].houseId +
              ',this);" onmouseout="moveout(this)" class="list-model">' +
              '<img src="' +
              image +
              '">' +
              '<div class="info">' +
              '<h4 class="ellipsis-1">' +
              resu1.data.list[i].houseName +
              "</h4>" +
              '<p><span class="big">' +
              resu1.data.list[i].price +
              "</span>元/m²·天</p>" +
              '<p class="clearfix">' +
              '<small class="pull-left">' +
              (resu1.data.list[i].price*30*area/10000).toFixed(1) +
              "万元/月</small>" +
              '<small class="pull-right">' +
              time +
              "</small>" +
              "</p>" +
              "</div>" +
              "</div>"
          );
        }
      }
    }
  }
}

//分页
function fy2(temp) {
  $("#page").empty();
  if (temp.length > 0) {
    var number;
    var num1 = temp.length % 8;
    if (num1 == 0) {
      number = temp.length / 8;
    } else {
      number = parseInt(temp.length / 8) + 1;
    }
    //分页
    $("#page").paging({
      pageNo: 8,
      totalPage: number,
      callback: function(num) {
        // $("#listfjh").empty();
        // dzkj(num);
      }
    });
    //dzkj("1");
    //$("#listfjh").empty();
  }
}
function fy() {
  $("#page").empty();
  $("#listfjh").empty();
  dzkj("1");
  var number;
  if (resu1 != undefined) {
    var num1 = resu1.data.count % 8;
    if (num1 == 0) {
      number = resu1.data.count / 8;
    } else {
      number = parseInt(resu1.data.count / 8) + 1;
    }
  }

  //分页
  $("#page").paging({
    pageNo: 8,
    totalPage: number,
    callback: function(num) {
      $("#listfjh").empty();
      dzkj(num);
    }
  });
}
	//添加浏览量
	   ajax("/api/v1/user/opt/addVisit",'post',{id:houseid,type:"3"},function(result){
      if(result.code == 200){
        //$("#fyyll").html(result.data);
      }
	   },false)
//待租空间
function dzkj(page1) {
  ajax(
    "/api/v1/building/buildingHomeRentSpace",
    "post",
    { buildingId: buildid, page: page1, size: "8" },
    function(result) {
      resu1 = result;
      if (result.code == 200) {
        roomNo = [];
        $("#dzkjzs").html("待租空间(" + resu1.data.count + "个)");
        for (var i = 0; i < result.data.list.length; i++) {
          var name = result.data.list[i].houseName.replace(buildingName+" |",'');
          roomNo.push(result.data.list[i].roomNo);
          var temp = result.data.list[i].releaseTime;
          if (temp != null) {
            var time = temp.substring(0, temp.length - 9);
          } else {
            var time = "";
          }
       var area = result.data.list[i].area;
          if (result.data.list[i].imgUrl) {
            $("#listfjh").append(
              '<div id="' +
                result.data.list[i].roomNo +
                '" onclick="fyxq(' +
                result.data.list[i].houseId +
                ',this);" onmouseover="movein(this)" onmouseout="moveout(this)" class="list-model" >' +
                '<img src="' +
                getImgUrl() +
                result.data.list[i].imgUrl +
                '">' +
                '<div class="info">' +
                '<h4 class="ellipsis-1">' +
                name +
                "</h4>" +
                '<p><span class="big">' +
                result.data.list[i].price +
                "</span>元/m²·天</p>" +
                '<p class="clearfix">' +
                '<small class="pull-left">' +
               (result.data.list[i].price*30*area/10000).toFixed(1) +
                "万元/月</small>" +
                '<small class="pull-right">' +
                time +
                "</small>" +
                "</p>" +
                "</div>" +
                "</div>"
            );
          } else {
            $("#listfjh").append(
              '<div id="' +
                result.data.list[i].roomNo +
                '" onclick="fyxq(' +
                result.data.list[i].houseId +
                ',this);" onmouseover="movein(this)" onmouseout="moveout(this)" class="list-model" >' +
                '<img src="static/ffyxq/images/noupload.png">' +
                '<div class="info">' +
                '<h4 class="ellipsis-1">' +
                name +
                "</h4>" +
                '<p><span class="big">' +
                result.data.list[i].price +
                "</span>元/m²·天</p>" +
                '<p class="clearfix">' +
                '<small class="pull-left">' +
                 (result.data.list[i].price*30*area/10000).toFixed(1) +
                "万元/月</small>" +
                '<small class="pull-right">' +
                time +
                "</small>" +
                "</p>" +
                "</div>" +
                "</div>"
            );                         
          }
          //onclick="fyxq('+result.data[i].houseId+');"
        }
      }
      if (dzc_service != undefined) {
        gethousehold();
      }
    },
    false
  );
}
//根据楼盘编号查询楼盘名字
function processCompletedcxlp(result){
	$("#title1").html(result.originResult.features[0].fieldValues[28]);
}
/**
 *
 * @param 点击列表中记录：跳转页面
 */
// function fyxq(houseid){
// 	window.open("xfyxq.html?name="+commname+"&id="+houseid,"_blank");
// }
function fyxq(houseid, hsid) {
  window.open(
    "fxfyxq.html?name=" +
      commname +
      "&hsid=" +
      hsid.id +
      "&houseid=" +
      houseid +
      "&buildid=" +
      buildid,
    "_blank"
  );
}
//3D楼盘展示出楼号
function louhao() {
  $.ajax({
    url: "js/js/marker.json",
    type: "GET",
    dataType: "json",
    async: false,
    success: function(data) {
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].louhao.length; j++) {
            var temp = data[i].datas[0].louhao[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].louhao[j].id,
              name: data[i].datas[0].louhao[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              label: {
                //文字标签
                text: data[i].datas[0].louhao[j].text,
                outlineWidth: 0,
                outlineColor: Cesium.Color.WHITE,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.WHITE,
                font: "15px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(0, -9) //偏移量
              }
            });
          }
        }
      }
    }
  });
}
/**
 * 放大按钮：根据相机的拉近，实现模型的放大效果
 */
function add() {
  $("#fy").attr("src", "images/fuyuan.png");
  $("#fd").attr("src", "images/fda1.png");
  $("#sx").attr("src", "images/suoxiao.png");
  var heading, pitch;
  if (btncount == 0) {
    heading = scene.camera.heading;
    //pitch = Cesium.Math.toRadians(-35.0);
    pitch = scene.camera.pitch;
  } else {
    heading = scene.camera.heading;
    //pitch = Cesium.Math.toRadians(-5.0);
    pitch = scene.camera.pitch;
  }
  var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(
      center.x - 0.00000000045916,
      center.y,
      tranheight + 10
    )
  );
  if (Range < 475 && Range > Rangeheight) {
    Range = Range - 30;
    scene.camera.lookAtTransform(
      transform,
      new Cesium.HeadingPitchRange(heading, pitch, Range)
    );
  } else {
    if (Range > 455) {
      Range = 455;
      scene.camera.lookAtTransform(
        transform,
        new Cesium.HeadingPitchRange(heading, pitch, Range)
      );
    } else if (Range < Rangeheight) {
      Range = Rangeheight;
    } else {
      Range = Rangeheight;
    }
  }
}
/**
 * 缩小按钮：根据相机的远离，使看到的模型缩小
 */
function reduce() {
  var heading, pitch;
  if (btncount == 0) {
    heading = scene.camera.heading;
    //pitch = Cesium.Math.toRadians(-35.0);
    pitch = scene.camera.pitch;
  } else {
    heading = scene.camera.heading;
    //pitch = Cesium.Math.toRadians(-5.0);
    pitch = scene.camera.pitch;
  }
  $("#fy").attr("src", "images/fuyuan.png");
  $("#fd").attr("src", "images/fangda.png");
  $("#sx").attr("src", "images/sxiao1.png");
  var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(
      center.x - 0.00000000045916,
      center.y,
      tranheight + 10
    )
  );
  if (Range <= 455 && Range >= Rangeheight) {
    Range = Range + 30;
    scene.camera.lookAtTransform(
      transform,
      new Cesium.HeadingPitchRange(heading, pitch, Range)
    );
  } else {
    if (Range > 455) {
      Range = 455;
    } else {
      Range = Rangeheight;
      scene.camera.lookAtTransform(
        transform,
        new Cesium.HeadingPitchRange(heading, pitch, Range)
      );
    }
  }
}
/**
 * 复原按钮：初始化场景中相机的方位角和高度
 */
function reset() {
  $("#fy").attr("src", "images/hyuan1.png");
  $("#fd").attr("src", "images/fangda.png");
  $("#sx").attr("src", "images/suoxiao.png");

  Value = 202;
  var pitch;
  if (btncount == 0) {
    pitch = Cesium.Math.toRadians(-35.0);
    Range = 474;
  } else {
    pitch = Cesium.Math.toRadians(pitchcsh);
    Range = range1;
  }
  var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(
      center.x + 0.00000000001114,
      center.y,
      tranheight + 10
    )
  );
  var heading = Cesium.Math.toRadians(lpheading);
  //var pitch = Cesium.Math.toRadians(-5.0);
  var range2 = Range;
  scene.camera.lookAtTransform(
    transform,
    new Cesium.HeadingPitchRange(heading, pitch, range2)
  );
}
//鼠标移入事件
function movein(val) {
  $("#listfjh div").css({ "background-color": "" });
  val.style.backgroundColor = "#EEEEEE";
  var sql = "RoomNo = '" + val.id + "' and  LPBH = '"+commname+"'";
  if (dzc_service != undefined) {
    var queryconfig = {
      url: dataurl,
      sql: sql,
      layerName: dzc_service.layers.layerhousehold,
      datalayerName: dzc_service.datalayers.layerhousehold,
      callback: processCompletedhouse1
    };
    _queryBySql(queryconfig);
  }
}
//返回除去鼠标移入时候户的smid
function showcwjg() {
  for (var i = 0; i < array.length; i++) {
    for (var j = 0; j < arrayfh.length; j++) {
      if (array[i] == arrayfh[j]) {
        array.splice(i, 1);
      }
    }
  }
  return array;
}
//鼠标移出事件
function moveout(val) {
  val.style.backgroundColor = "";
  //var sql = "RoomNo = '" + val.id + "'";
var sql = "RoomNo = '" + val.id + "' and  LPBH = '"+commname+"'";
  if (dzc_service != undefined) {
    var queryconfig = {
      url: dataurl,
      sql: sql,
      layerName: dzc_service.layers.layerhousehold,
      datalayerName: dzc_service.datalayers.layerhousehold,
      callback: processCompletedhouseout
    };
    _queryBySql(queryconfig);
  }
}
//鼠标移入触发事件
function processCompletedhouse1(getFeaturesEventArgs) {
  arrayfh = [];
  var list = getFeaturesEventArgs.originResult.features;
  var count = getFeaturesEventArgs.originResult.featureCount;
  for (var j = 0; j < list.length; j++) {
    var smid = getFeaturesEventArgs.originResult.features[j].ID;
    arrayfh.push(smid);
  }
  //array = showcwjg();
  if (array.length > 0 || arrayfh.length > 0) {
    promisehouse.then(function(layer) {
      layer._selectColorType = 1;
      layer.selectEnabled = true;
    if(array.length > 0){
 layer.visible = true;
      //layer.setObjsVisible(arrayfh,true);
      layer.setObjsColor(array,new Cesium.Color(0,139/255,210/255,1));
}
if(arrayfh.length > 0){
layer.visible = true;
  layer.setObjsColor(arrayfh, Cesium.Color.YELLOW);
}
     
    
    });
  } else {
    promisehouse.then(function(layer) {
      layer._selectColorType = 1;
      layer.selectEnabled = true;
      layer.visible = false;
      layer.setObjsColor(arrayfh, Cesium.Color.YELLOW);
    });
  }
}
//鼠标移出触发事件
function processCompletedhouseout(getFeaturesEventArgs) {
  arrayfh1 = [];
  var list = getFeaturesEventArgs.originResult.features;
  var count = getFeaturesEventArgs.originResult.featureCount;
  for (var j = 0; j < list.length; j++) {
    var smid = getFeaturesEventArgs.originResult.features[j].ID;
    arrayfh1.push(smid);
  }
  //array = showcwjg();
  // if(arrayfh1.length > 0){
  // 	promisehouse.then(function(layer){
  // 	 	layer._selectColorType = 1;
  // 	 	layer.selectEnabled = true;
  // 	 	layer.visible = true;
  // 	 	//layer.setObjsVisible(arrayfh1,true);
  // 		layer.setObjsColor(arrayfh1,new Cesium.Color(0,139/255,210/255,1));
  // 		layer.setObjsColor(array,new Cesium.Color(0,139/255,210/255,1));
  // 	 });
  // }
  if (arrayfh1.length > 0) {
    promisehouse.then(function(layer) {
      layer._selectColorType = 1;
      layer.selectEnabled = true;
      layer.visible = true;
      //layer.setObjsVisible(arrayfh1,true);
     if(array.length > 0){
  layer.setObjsColor(array, new Cesium.Color(0, 139 / 255, 210 / 255, 1));
}
 if(arrayfh1.length > 0){
 layer.setObjsColor(
        arrayfh1,
        new Cesium.Color(0, 139 / 255, 210 / 255, 1)
      );
}   

    });
  } else {
    promisehouse.then(function(layer) {
      layer._selectColorType = 1;
      layer.selectEnabled = true;
      layer.visible = false;
    });
  }
}
//全景周边中标注
function mark() {
  $.ajax({
    url: "js/js/marker.json",
    type: "GET",
    dataType: "json",
    async: false,
    success: function(data) {
      //添加文字和图片
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].wenimg.length; j++) {
            var temp = data[i].datas[0].wenimg[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var temp1 = data[i].datas[0].wenimg[j].pixelOffset;
            var result1 = temp1.split(",");
            if (result1.length > 0) {
              var left = result1[0];
              var right = result1[1];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].wenimg[j].id,
              name: data[i].datas[0].wenimg[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              billboard: {
                image: data[i].datas[0].wenimg[j].billboard,
                width: 32,
                height: 32
              },
              label: {
                //文字标签
                text: data[i].datas[0].wenimg[j].text,
                outlineWidth: 0,
                outlineColor: Cesium.Color.YELLOW,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.YELLOW,
                font: "15px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.LEFT, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(
                  parseFloat(left),
                  parseFloat(right)
                ) //偏移量
              }
            });
          }
        }
      }
      //添加图片
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].img.length; j++) {
            var temp = data[i].datas[0].img[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].img[j].id,
              name: data[i].datas[0].img[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              billboard: {
                //图标
                image: data[i].datas[0].img[j].image,
                width: 32,
                height: 32
              }
            });
          }
        }
      }
      //添加楼号
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].louhao.length; j++) {
            var temp = data[i].datas[0].louhao[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].louhao[j].id,
              name: data[i].datas[0].louhao[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              label: {
                //文字标签
                text: data[i].datas[0].louhao[j].text,
                outlineWidth: 0,
                outlineColor: Cesium.Color.WHITE,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.WHITE,
                font: "18px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(0, -9) //偏移量
              }
            });
          }
        }
      }
      //添加文本
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].wenben.length; j++) {
            var temp = data[i].datas[0].wenben[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].wenben[j].id,
              name: data[i].datas[0].wenben[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              label: {
                //文字标签
                text: data[i].datas[0].wenben[j].text,
                outlineWidth: 0,
                outlineColor: Cesium.Color.YELLOW,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.YELLOW,
                font: "20px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(0, -9) //偏移量
              }
            });
          }
        }
      }
      //添加道路
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].daolu.length; j++) {
            var temp = data[i].datas[0].daolu[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].daolu[j].id,
              name: data[i].datas[0].daolu[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              label: {
                //文字标签
                text: data[i].datas[0].daolu[j].text,
                outlineWidth: 1,
                outlineColor: Cesium.Color.LIME,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.LIME,

                font: "20px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(0, -9) //偏移量
              }
            });
          }
        }
      }
    }
  });
}
function gethousehold(value) {
  if(roomNo.length > 0){
		var str="(";
		var fjh = roomNo.toString();
		var f = [];
		f = fjh.split(",");
		for(var j=0;j < f.length;j++){
			if(j < f.length-1 ){
				str = str +" RoomNo = '" +f[j] + "' or";
			}else if( j == f.length-1){
				str = str + " RoomNo = '" +f[j]+"'";
			}else{
				str = str;
			}
		}
		var string="";
		str += ") and LPBH = '"+commname+"'";
		//var count=value.length;
		var sql= str;
		var queryconfig={
		        url:dataurl,
		        sql:sql,
		        layerName:dzc_service.layers.layerhousehold,
		        datalayerName:dzc_service.datalayers.layerhousehold,
		        callback:processCompletedhouse
		    };
			_queryBySql(queryconfig);
	}
}
function processCompletedhouse(getFeaturesEventArgs) {
  array = [];
  array1 = [];
  var list = getFeaturesEventArgs.originResult.features;
  var count = getFeaturesEventArgs.originResult.featureCount;
  for (var j = 0; j < list.length; j++) {
    var smid = getFeaturesEventArgs.originResult.features[j].ID;
    array.push(smid);
    array1.push(smid);
  }
  if (count > 0) {
    promisehouse.then(function(layer) {
      layer._selectColorType = 1;
      layer.selectEnabled = true;
      layer.visible = true;
      layer.setObjsVisible(array, true);
      layer.setObjsColor(array, new Cesium.Color(0, 139 / 255, 210 / 255, 1));
    });
  }

  //$("#smid").val("["+array+"]");
}
//根据房号查询出smid
function getsmid(arrayid) {
  if (arrayid.length == 0) {
    arraysx = [];
  } else {
    var aid = unique(arrayid);
    var str = "(";
    var fjh = aid.toString();
    var f = [];
    f = fjh.split(",");
    for (var j = 0; j < f.length; j++) {
      if (j < f.length - 1) {
        str = str + " RoomNo = '" + f[j] + "' or";
      } else if (j == f.length - 1) {
        str = str + " RoomNo = '" + f[j] + "'";
      } else {
        str = str;
      }
    }
  str += ") and LPBH = '"+commname+"'";
    var string = "";
    //var count=value.length;
    var sql = str;
    var queryconfig = {
      url: dataurl,
      sql: sql,
      layerName: dzc_service.layers.layerhousehold,
      datalayerName: dzc_service.datalayers.layerhousehold,
      callback: processCompletedsmid
    };
    _queryBySql(queryconfig);
  }
}
function processCompletedsmid(getFeaturesEventArgs) {
  arraysx = [];
  var list = getFeaturesEventArgs.originResult.features;
  var count = getFeaturesEventArgs.originResult.featureCount;
  for (var j = 0; j < list.length; j++) {
    var smid = getFeaturesEventArgs.originResult.features[j].ID;
    arraysx.push(smid);
  }
  promisehouse.then(function(layer) {
    layer._selectColorType = 1;
    layer.selectEnabled = true;
    layer.visible = true;
    layer.setObjsVisible(arraysx, true);
    layer.setObjsColor(arraysx, new Cesium.Color(0, 139 / 255, 210 / 255, 1));
  });
  //$("#smid").val("["+array+"]");
}

/**
 * 功能：根据选中房源面积和楼层高低按钮后，显示出符合条件的房源信息和三维中符合条件的房源变红色
 */
var arraydi = [],
  arrayzhong = [],
  arraygao = [],
  arrayxiao = [],
  arrayzhon = [],
  arrayda = [],
  arraychaogao = [];
function change(val) {
  $("#page").empty();
  var temp = "";
  var arrayli = $("#mianji a");
  for (var i = 0; i < arrayli.length; i++) {
    if (arrayli[i].className == "active") {
      temp = arrayli[i].id;
    }
  }
  var temp1 = "";
  var arrayli1 = $("#louceng a");
  for (var i = 0; i < arrayli1.length; i++) {
    if (arrayli1[i].className == "active") {
      temp1 = arrayli1[i].id;
    }
  }
  $("#listfjh").empty();
  for (var i = 0;  i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].floor <= 6) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arraydi.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].area < 200) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arrayxiao.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].area >= 200 && resu1.data.list[i].area < 800) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arrayzhon.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].area > 800) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arrayda.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].floor >= 7 && resu1.data.list[i].floor <= 15) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arrayzhong.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].floor >= 16 && resu1.data.list[i].floor <= 30) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arraygao.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.length; i++) {
    if (resu1.data[i].floor >= 30) {
      var ar = [];
      ar.push(resu1.data[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arraychaogao.push(f);
      }
    }
  }
  arraydi = unique(arraydi);
  arrayzhong = unique(arrayzhong);
  arraygao = unique(arraygao);
  arrayxiao = unique(arrayxiao);
  arrayzhon = unique(arrayzhon);
  arrayda = unique(arrayda);
  arraychaogao = unique(arraychaogao);
  if (val.id == "di") {
    $("#gao").removeClass("active");
    $("#chaogao").removeClass("active");
    $("#zhong").removeClass("active");
    if ($("#di").hasClass("active")) {
      $("#di").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp == "xiao") {
          getsmid(arrayxiao);
          fy2(arrayxiao);
          cxjg(arrayxiao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayxiao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(
              array1,
              new Cesium.Color(0, 139 / 255, 210 / 255, 1)
            );
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "zhon") {
          getsmid(arrayzhon);
          fy2(arrayzhon);
          cxjg(arrayzhon);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayzhon.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "da") {
          getsmid(arrayda);
          fy2(arrayda);
          cxjg(arrayda);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayda.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    } else {
      $("#di").addClass("active");
      if ($("#count li .active").size() == 1) {
        getsmid(arraydi);
        fy2(arraydi);
        cxjg(arraydi);
        promisehouse.then(function(layer) {
          layer.visible = true;
          if (arraydi.length == 0) {
            arraysx = [];
            layer.visible = false;
          }

          layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
          layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
        });
      } else {
        if (temp == "xiao") {
          var c = [];
          c = arrayIntersection(arraydi.sort(), arrayxiao.sort());
          var arr = unique(c);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);

          /*	houseid = [];
				var imgurl1 = "http://114.113.112.155:9000/image/";
        		for(var i = 0;i < resu1.data.length;i++){
        			for(var j = 0;j < arr.length; j++){
        				
        				if(resu1.data[i].houseId == arr[j]){
        					var temp = resu1.data[i].releaseTime;
    						if(temp != null){
    							var time = temp.substring(0,temp.length-9);
    						}else{
    							var time = '';
    						}
    						$("#listfjh").append('<div id="'+resu1.data[i].houseId+'" onmouseover="movein(this)" onmouseout="moveout(this)" class="list-model">'+
    	                            '<img src="'+getImgUrl()+resu1.data[i].imgUrl+'">'+
    	                            '<div class="info">'+
    	                                '<h4 class="ellipsis-1">'+resu1.data[i].houseName+'</h4>'+
    	                                '<p><span class="big">'+resu1.data[i].price+'</span>元/m²·天</p>'+
    	                                '<p class="clearfix">'+
    	                                    '<small class="pull-left">'+resu1.data[i].monthPrice+'万元/月</small>'+
    	                                    '<small class="pull-right">'+time+'</small>'+
    	                                '</p>'+
    	                            '</div>'+
    	                        '</div>');
        				}
        			}
        		}*/

          //resu1 = unique(resu1);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "zhon") {
          var c = [];
          c = arrayIntersection(arrayzhon.sort(), arraydi.sort());
          var arr = unique(c);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          //resu1 = unique(resu1);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }

            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "da") {
          var c = [];
          c = arrayIntersection(arrayda.sort(), arraydi.sort());
          var arr = unique(c);
          //var resu = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          //resu1 = unique(resu1);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    }
  } else if (val.id == "zhong") {
    $("#chaogao").removeClass("active");
    $("#gao").removeClass("active");
    $("#di").removeClass("active");
    if ($("#zhong").hasClass("active")) {
      $("#zhong").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp == "xiao") {
          getsmid(arrayxiao);
          fy2(arrayxiao);
          cxjg(arrayxiao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayxiao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "zhon") {
          getsmid(arrayzhon);
          fy2(arrayzhon);
          cxjg(arrayzhon);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayzhon.length == 0) {
              arraysx = [];
              layer.visible = false;
            }

            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "da") {
          getsmid(arrayda);
          fy2(arrayda);
          cxjg(arrayda);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayzhon.length == 0) {
              arrayda = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    } else {
      $("#zhong").addClass("active");
      if ($("#count li .active").size() == 1) {
        getsmid(arrayzhong);
        fy2(arrayzhong);
        cxjg(arrayzhong);
        promisehouse.then(function(layer) {
          layer.visible = true;
          if (arrayzhong.length == 0) {
            arraysx = [];
            layer.visible = false;
          }
          layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
          layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
        });
      } else {
        if (temp == "xiao") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arrayzhong.sort());
          var arr = unique(c);
          //var resu = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          //resu1 = unique(resu1);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "zhon") {
          var c = [];
          c = arrayIntersection(arrayzhon.sort(), arrayzhong.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "da") {
          var c = [];
          c = arrayIntersection(arrayzhong.sort(), arrayda.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    }
  } else if (val.id == "gao") {
    $("#chaogao").removeClass("active");
    $("#zhong").removeClass("active");
    $("#di").removeClass("active");
    if ($("#gao").hasClass("active")) {
      $("#gao").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp == "xiao") {
          getsmid(arrayxiao);
          fy2(arrayxiao);
          cxjg(arrayxiao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayxiao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "zhon") {
          getsmid(arrayzhon);
          fy2(arrayzhon);
          cxjg(arrayzhon);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayzhon.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "da") {
          getsmid(arrayda);
          fy2(arrayda);
          cxjg(arrayda);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayda.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    } else {
      $("#gao").addClass("active");
      if ($("#count li .active").size() == 1) {
        getsmid(arraygao);
        fy2(arraygao);
        cxjg(arraygao);
        promisehouse.then(function(layer) {
          layer.visible = true;
          if (arraygao.length == 0) {
            arraysx = [];
            layer.visible = false;
          }
          layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
          layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
        });
      } else {
        if (temp == "xiao") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arraygao.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "zhon") {
          var c = [];
          c = arrayIntersection(arrayzhon.sort(), arraygao.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "da") {
          var c = [];
          c = arrayIntersection(arrayda.sort(), arraygao.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    }
  } else if (val.id == "chaogao") {
    $("#gao").removeClass("active");
    $("#zhong").removeClass("active");
    $("#di").removeClass("active");
    if ($("#chaogao").hasClass("active")) {
      $("#chaogao").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp == "xiao") {
          getsmid(arrayxiao);
          fy2(arrayxiao);
          cxjg(arrayxiao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayxiao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "zhon") {
          getsmid(arrayzhon);
          fy2(arrayzhon);
          cxjg(arrayzhon);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayzhon.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "da") {
          getsmid(arrayda);
          fy2(arrayda);
          cxjg(arrayda);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayda.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    } else {
      $("#chaogao").addClass("active");
      if ($("#count li .active").size() == 1) {
        getsmid(arraychaogao);
        fy2(arraychaogao);
        cxjg(arraychaogao);
        promisehouse.then(function(layer) {
          layer.visible = true;
          if (arraychaogao.length == 0) {
            arraysx = [];
            layer.visible = false;
          }
          layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
          layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
        });
      } else {
        if (temp == "xiao") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arraychaogao.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "zhon") {
          var c = [];
          c = arrayIntersection(arrayzhon.sort(), arraychaogao.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp == "da") {
          var c = [];
          c = arrayIntersection(arrayda.sort(), arraychaogao.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    }
  } else if (val.id == "xiao") {
    $("#zhon").removeClass("active");
    $("#da").removeClass("active");
    if ($("#xiao").hasClass("active")) {
      $("#xiao").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp1 == "di") {
          getsmid(arraydi);
          fy2(arraydi);
          cxjg(arraydi);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraydi.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "zhong") {
          getsmid(arrayzhong);
          fy2(arrayzhong);
          cxjg(arrayzhong);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayzhong.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "gao") {
          getsmid(arraygao);
          fy2(arraygao);
          cxjg(arraygao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraygao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "chaogao") {
          getsmid(arraychaogao);
          fy2(arraychaogao);
          cxjg(arraychaogao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraychaogao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    } else {
      $("#xiao").addClass("active");
      if ($("#count li .active").size() == 1) {
        getsmid(arrayxiao);
        fy2(arrayxiao);
        cxjg(arrayxiao);
        promisehouse.then(function(layer) {
          layer.visible = true;
          if (arrayxiao.length == 0) {
            arraysx = [];
            layer.visible = false;
          }
          layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
          layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
        });
      } else {
        if (temp1 == "di") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arraydi.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "zhong") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arrayzhong.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "gao") {
          var c = [];
          c = arrayIntersection(arraygao.sort(), arrayxiao.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "chaogao") {
          var c = [];
          c = arrayIntersection(arraychaogao.sort(), arrayxiao.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    }
  } else if (val.id == "zhon") {
    $("#xiao").removeClass("active");
    $("#da").removeClass("active");
    if ($("#zhon").hasClass("active")) {
      $("#zhon").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp1 == "zhong") {
          getsmid(arrayzhong);
          fy2(arrayzhong);
          cxjg(arrayzhong);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayzhong.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "di") {
          getsmid(arraydi);
          fy2(arraydi);
          cxjg(arraydi);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraydi.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "gao") {
          getsmid(arraygao);
          fy2(arraygao);
          cxjg(arraygao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraygao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "chaogao") {
          getsmid(arraychaogao);
          fy2(arraychaogao);
          cxjg(arraychaogao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraychaogao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    } else {
      $("#zhon").addClass("active");
      if ($("#count li .active").size() == 1) {
        getsmid(arrayzhon);
        fy2(arrayzhon);
        cxjg(arrayzhon);
        promisehouse.then(function(layer) {
          layer.visible = true;
          if (arrayzhon.length == 0) {
            arraysx = [];
            layer.visible = false;
          }
          layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
          layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
        });
      } else {
        if (temp1 == "di") {
          var c = [];
          c = arrayIntersection(arraydi.sort(), arrayzhon.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "zhong") {
          var c = [];
          c = arrayIntersection(arrayzhong.sort(), arrayzhon.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "gao") {
          var c = [];
          c = arrayIntersection(arraygao.sort(), arrayzhon.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "chaogao") {
          var c = [];
          c = arrayIntersection(arraygao.sort(), arrayzhon.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    }
  } else if (val.id == "da") {
    $("#xiao").removeClass("active");
    $("#zhon").removeClass("active");
    if ($("#da").hasClass("active")) {
      $("#da").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp1 == "di") {
          getsmid(arraydi);
          fy2(arraydi);
          cxjg(arraydi);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraydi.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "zhong") {
          getsmid(arrayzhong);
          fy2(arrayzhong);
          cxjg(arrayzhong);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arrayzhong.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "gao") {
          getsmid(arraygao);
          fy2(arraygao);
          cxjg(arraygao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraygao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "chaogao") {
          getsmid(arraychaogao);
          fy2(arraychaogao);
          cxjg(arraychaogao);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arraychaogao.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    } else {
      $("#da").addClass("active");
      if ($("#count li .active").size() == 1) {
        getsmid(arrayda);
        fy2(arrayda);
        cxjg(arrayda);
        promisehouse.then(function(layer) {
          layer.visible = true;
          if (arrayda.length == 0) {
            arraysx = [];
            layer.visible = false;
          }
          layer.setObjsColor(array1, new Cesium.Color(0, 0, 0, 0));
          layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
        });
      } else {
        if (temp1 == "di") {
          var c = [];
          c = arrayIntersection(arraydi.sort(), arrayda.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "zhong") {
          var c = [];
          c = arrayIntersection(arrayzhong.sort(), arrayda.sort());
          //c = Array.intersect(arrayzhong.uniquelize(), arrayda.uniquelize());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "gao") {
          var c = [];
          c = arrayIntersection(arraygao.sort(), arrayda.sort());
          var arr = unique(c);
          //resu1 = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        } else if (temp1 == "chaogao") {
          var c = [];
          c = arrayIntersection(arraychaogao.sort(), arrayda.sort());
          var arr = unique(c);
          //var resu = unique(resu1);
          getsmid(arr);
          fy2(arr);
          cxjg(arr);
          promisehouse.then(function(layer) {
            layer.visible = true;
            if (arr.length == 0) {
              arraysx = [];
              layer.visible = false;
            }
            layer.setObjsColor(arraysx, Cesium.Color.YELLOW);
          });
        }
      }
    }
  }
}
// 获取楼盘图片
ajax(
  "/api/v1/building/getBuildingOutDoorPic",
  "POST",
  { buildingId: getParams("buildid") },
  function(result) {
    if (result.data && result.data.length > 0) {
      for (var i = 0; i < result.data.length; i++) {
        var image = "static/ffyxq/images/noupload.png";
        if (result.data[i].imgUrl) {
          image = getImgUrl() + result.data[i].imgUrl;
        } else {
          image = "static/ffyxq/images/noupload.png";
        }
        $("#piclist").append(
          '<div class="swiper-slide">' +
            '<a href="' +
            image +
            '"><img src="' +
            image +
            '" /></a>' +
            "</div>"
        );
      }
    } else {
      $("#piclist").append(
        '<div class="swiper-slide">' +
          '<a href="static/ffyxq/images/noupload.png"><img src="static/ffyxq/images/noupload.png" /></a>' +
          "</div>"
      );
    }
  },
  false
);

//求两个数组的交集
function arrayIntersection(a, b) {
  var ai = 0,
    bi = 0;
  var result = new Array();
  while (ai < a.length && bi < b.length) {
    if (a[ai] < b[bi]) {
      ai++;
    } else if (a[ai] > b[bi]) {
      bi++;
    } /* they're equal */ else {
      result.push(a[ai]);
      ai++;
      bi++;
    }
  }
  return result;
}
/**
 * function : 是数组中元素的值唯一化
 * @param arr
 * @returns {Array}
 */
function unique(arr) {
  // 遍历arr，把元素分别放入tmp数组(不存在才放)
  var tmp = new Array();
  for (var i in arr) {
    //该元素在tmp内部不存在才允许追加
    if (tmp.indexOf(arr[i]) == -1) {
      tmp.push(arr[i]);
    }
  }
  return tmp;
}
